package l1j.server.server.model.damage;

import l1j.server.server.WarTimeController;
import l1j.server.server.model.L1CastleLocation;
import l1j.server.server.model.Instance.L1NpcInstance;
import l1j.server.server.model.Instance.L1PetInstance;
import l1j.server.server.model.Instance.L1SummonInstance;

public class L1MagicOnNpc {
	private L1NpcInstance _target;
	private L1Dmg _dmg;

	public L1MagicOnNpc(L1NpcInstance target, L1Dmg dmg) {
		_target = target;
		_dmg = dmg;
	}

	public void calcDmgOnNpc() {
		boolean isNowWar = false;
		int castleId = L1CastleLocation.getCastleIdByArea(_target);
		if (castleId > 0) {
			isNowWar = WarTimeController.getInstance().isNowWar(castleId);
		}
		if (!isNowWar) {
			if (_target instanceof L1PetInstance) {
				_dmg.div(8);
			}
			if (_target instanceof L1SummonInstance) {
				L1SummonInstance summon = (L1SummonInstance) _target;
				if (summon.isExsistMaster()) {
					_dmg.div(8);
				}
			}
		}
	}
}
